package com.zib.vread.sinaweibo.mvp.view.activity;

import android.content.Intent;
import android.os.Handler;

import com.zib.vread.sinaweibo.R;
import com.zib.vread.sinaweibo.api.AccessTokenKeeper;
import com.zib.vread.sinaweibo.base.BaseActivity;


public class WelcomeActivity extends BaseActivity {
    private Intent startIntent;
    private Handler handler = new Handler();

    @Override
    public int getLayoutId() {
        return R.layout.activity_welcome;
    }

    @Override
    public void initView() {
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                if (AccessTokenKeeper.readAccessToken(WelcomeActivity.this).isSessionValid()) {
                    startIntent = new Intent(WelcomeActivity.this, MainActivity.class);
                } else {
                   startIntent = new Intent(WelcomeActivity.this, UnLoginActivity.class);
                }

                startActivity(startIntent);
                finish();
            }
        }, 500);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }
}
